package yzy.ecps.ws.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import yzy.ecps.dao.GoodsDao;
import yzy.ecps.model.BtcGoods;
import yzy.ecps.utils.EcpsUtils;
import yzy.ecps.utils.FMutil;
import yzy.ecps.ws.WSGoods;

@Service
public class WSGoodsImpl implements WSGoods {
	@Autowired
	private GoodsDao goodsDao;
	
	public String publishGoods(Long goodsId, String pwd) throws Exception {
		String wspwd = EcpsUtils.getValueByKeyFormSysProperties("ws_portal_pwd");
		if(!wspwd.equals(pwd))
			return "pwderror";
		BtcGoods goods = goodsDao.getGoodsById(goodsId);
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("item", goods);
		FMutil fm = new FMutil();
		fm.ouputFile("goodsDetail.ftl", goods.getGoodsId()+".html", map);
		return "success";
	}

}
